﻿using Acme.BookStore.Authors;
using Acme.BookStore.Bass;
using Acme.BookStore.Books;
using Acme.BookStore.Navigates;
using AutoMapper;

namespace Acme.BookStore
{
    public class BookStoreApplicationAutoMapperProfile : Profile
    {
        public BookStoreApplicationAutoMapperProfile()
        {
            CreateMap<Book, BookDto>();

            CreateMap<CreateUpdateBookDto, Book>();

            CreateMap<Author, AuthorDto>();

            CreateMap<Author, AuthorLookupDto>();

            CreateMap<Bas, BasDto>().AfterMap((s, d) => d.Name = s.Code.Trim().Length > 1 ? "Code长度>1" : "Code长度<1");

            CreateMap<Student, StudentDto>();

            CreateMap<StuBook, StuBookDto>();

            CreateMap<School, SchoolDto>();

            CreateMap<Teacher, TeacherDto>();

            CreateMap<Room, RoomDto>();
        }
    }
}